<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@page import="java.util.*,com.netqin.kingviker.ProcessCustomService,org.activiti.engine.*,java.util.zip.*,org.activiti.engine.task.*"%>
<%
	TaskService taskService = ProcessCustomService.getTaskService();
	
	RuntimeService runtimeService = ProcessCustomService.getRuntimeService();
	
	String taskId = request.getParameter("taskId");
	
	List<Task> taskList = taskService.createTaskQuery().taskId(taskId).list();
	Task task = taskList.get(0);
	String taskName = task.getName();
	String result = new String(request.getParameter("result").getBytes("ISO-8859-1"), "UTF-8");
	if(result.equals("同意")){
		Map map = new HashMap();
		map.put("day",request.getParameter("day"));
		map.put("reason",new String(request.getParameter("reason").getBytes("ISO-8859-1"), "UTF-8"));
		map.put("type",request.getParameter("type"));
		taskService.complete(taskId, map);
	}else if(result.equals("驳回")){
		ProcessCustomService.backProcess(taskId, request.getParameter("backActivityId"), runtimeService.getVariables(ProcessCustomService.findProcessInstanceByTaskId(taskId).getId()));	
	}
	response.sendRedirect("index.jsp");
%>